package utils

import (
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"xinanjiang-go/app"
)

func ReadParamsFile(runPath string) app.Params {
	filePath := filepath.Join(runPath, "Data.json")
	file, err := os.Open(filePath)
	defer file.Close()
	if err != nil {
		fmt.Println(err)
		return app.Params{}
	}
	var params app.Params
	err = json.NewDecoder(file).Decode(&params)
	if err != nil {
		return app.Params{}
	}
	return params
}
